package com.jbh.recordlibrary.u;

import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.io.File;
public class SdcardUtil {



    /**
     * 本地文件保存路径
     *
     * @return
     */
    public static String getSaveDir(Context context) {
        String fileDir;
        /**
         * 判断SD卡是否存在
         */
        if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
            fileDir = Environment.getExternalStorageDirectory().getPath();
            if (Utils.isEmptyStr(fileDir)) {
                Log.v("sdCard", "-------------->SD card path == null !");
                File f = context.getExternalCacheDir();
                fileDir = f.getPath();
            }


        } else {
            Log.v("sdCard", "-------------->SD card not mounted!");
            File f = context.getCacheDir();
            fileDir = f.getPath();
        }



        File file=new File(context.getExternalFilesDir(null) +File.separator+ "yxjRecord");

        if(!file.exists()){
            file.mkdir();
        }
        return file.getAbsolutePath();
    }
}
